import '../helper/dioHelper.dart';

class XHSS {
  int TypeId;
  int State;
  double Kd;
  double Hours;
  String BeginTM;
  String EndTM;
  String OKTM;

  XHSS(this.TypeId, this.State, this.Kd, this.Hours, this.BeginTM, this.EndTM,
      this.OKTM);
  XHSS.fromJson(Map<String, dynamic> json)
      : TypeId = json["TypeId"],
        State = json["State"],
        Kd = json["Kd"],
        Hours = json["Hours"],
        BeginTM = json["BeginTM"],
        EndTM = json["EndTM"],
        OKTM = json["OKTM"];
  Map<String, dynamic> toJson() => {
        'TypeId': TypeId,
        'State': State,
        'Kd': Kd,
        'Hours': Hours,
        'BeginTM': BeginTM,
        'EndTM': EndTM,
        'OKTM': OKTM,
      };

  static Future<XHSS?> Get(int typeId) async {
    var response = await DioHelper.Get("/XHSSZT/GetXHSS?typeId=$typeId", {});

    if (response.statusCode == 200) return new XHSS.fromJson(response.data);
    return null;
  }
}
